<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增活动参与人员明细')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-agentActivityDetails-edit" th:object="${agentActivityDetails}">
        <input name="id" th:value="*{id}" type="hidden">
        <div class="tabs-left">
            <ul class="nav nav-tabs">
                <li class="active"><a data-toggle="tab" href="#info">活动对象</a>
                </li>
                <li class=""><a data-toggle="tab" href="#note">考核标准</a>
                </li>
            </ul>
            <div class="tab-content ">
                <div id="info" class="tab-pane active">
                    <div class="panel-body">
                        <div class="form-group ">
                            <label class="col-sm-3 is-required control-label">选择活动：</label>
                            <div class="col-sm-8">
                                <input name="actName" th:value="*{agentActivity.actName}" id="actName" class="form-control" onclick="selectAgentActivityList()" readonly minlength="1" maxlength="20" required type="text">
                                <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                                <input name="actId"  th:value="*{actId}" id="actId"  type="hidden">
                            </div>
                        </div>
                        <div class="form-group ">
                            <label class="col-sm-3 control-label is-required">服务商编号：</label>
                            <div class="col-sm-8">
                                <input name="agentNum" th:value="*{agentNum}" id="xagentNum" required minlength="1" readonly maxlength="20" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group ">
                            <label class="col-sm-3 is-required control-label">服务商名称：</label>
                            <div class="col-sm-8">
                                <input name="agentName" th:value="*{agentName}" id="xagentName"  class="form-control" readonly minlength="1" maxlength="20" required type="text">
                                <i class="fa fa-search" style="margin-top: -22px;margin-right:3px;float:right;"></i>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 is-required control-label">活动等级</label>
                            <div class="col-sm-2">
                                <select name="startGrade" class="form-control m-b" required>
                                    <option value="1" th:field="*{startGrade}">V1</option>
                                    <option value="2" th:field="*{startGrade}">V2</option>
                                    <option value="3" th:field="*{startGrade}">V3</option>
                                    <option value="4" th:field="*{startGrade}">V4</option>
                                    <option value="5" th:field="*{startGrade}">V5</option>
                                    <option value="6" th:field="*{startGrade}">V6</option>
                                    <option value="7" th:field="*{startGrade}">V7</option>
                                    <option value="8" th:field="*{startGrade}">V8</option>
                                    <option value="9" th:field="*{startGrade}">V9</option>
                                </select>
                            </div>
                            <label style="margin-right: 50px;" class="col-sm-1 control-label">至</label>
                            <div class="col-sm-2">
                                <select name="endGrade" class="form-control m-b"  required>
                                    <option value="1" th:field="*{endGrade}">V1</option>
                                    <option value="2" th:field="*{endGrade}">V2</option>
                                    <option value="3" th:field="*{endGrade}">V3</option>
                                    <option value="4" th:field="*{endGrade}">V4</option>
                                    <option value="5" th:field="*{endGrade}">V5</option>
                                    <option value="6" th:field="*{endGrade}">V6</option>
                                    <option value="7" th:field="*{endGrade}">V7</option>
                                    <option value="8" th:field="*{endGrade}">V8</option>
                                    <option value="9" th:field="*{endGrade}">V9</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label is-required">活动状态：</label>
                            <div class="col-sm-8">
                                <select name="status" class="form-control m-b" th:value="*{status}">
                                    <option value="1">开启</option>
                                    <option value="2">关闭</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="note" class="tab-pane">
                    <div class="panel-body">
                        <div class="form-group ">
                            <label class="col-sm-3 is-required control-label">考核标准1：</label>
                            <div class="col-sm-8">
                                <input name="norm1" th:value="*{norm1}" id="norm1" class="form-control" minlength="1" maxlength="5" required type="text">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>活动月当月开通新增有效商户大于等于?户</span>
                            </div>
                        </div>
                        <div class="form-group ">
                            <label class="col-sm-3 is-required control-label">考核标准2：</label>
                            <div class="col-sm-8">
                                <input name="norm2" th:value="*{norm2}" id="norm2" class="form-control" minlength="1" maxlength="5" required type="text">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>所有开通商户中，在活动月次月，即考核月，需有大于等于总户数的?%且满足交易量（计算贷记卡+闪付扫码交易）大于等于两万</span>
                            </div>
                        </div>
                        <div class="form-group ">
                            <label class="col-sm-3 is-required control-label">奖励：</label>
                            <div class="col-sm-8">
                                <input name="award" th:value="*{award}" id="award" class="form-control" minlength="1" maxlength="5" required type="text">
                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>满足标准1和标准2会在考核月的次月发放?元的底薪奖励</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
    var prefix = ctx + "salaryPlan/agentActivityDetails"
    var actPrefix = ctx + "salaryPlan/agentActivity";
    var agentInfoPrefix = ctx + "agentInfo/agentInfo";
    $("#form-agentActivityDetails-add").validate({
        focusCleanup: true
    });

    /**
     * 选择活动
     */
    function selectAgentActivityList() {
        var url = actPrefix + "/selectAgentActivityList";
        $.modal.open("选择活动" , url, '800',"600");
    }

    /**
     * 选择服务商
     */
    function selectAgentInfoAll() {
        var url = agentInfoPrefix+ "/selectAgentInfoAll";
        $.modal.open("选择下级服务商" , url, '900',"600");
    }


    function submitHandler() {
        if ($.validate.form()) {
            var award = $("#award").val()
            var norm2 = $("#norm2").val()
            var norm1 = $("#norm1").val()
            if ($.common.isEmpty(award) || $.common.isEmpty(norm1) || $.common.isEmpty(norm2)){
                $.modal.alertError('考核标准不可为空');
                return;
            }
            $.operate.save(prefix + "/edit", $('#form-agentActivityDetails-edit').serialize());
        }
    }
</script>
</body>
</html>